package com.mfin.bom.objects;

// Generated 17 Jun, 2012 11:27:33 PM by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * LoanPreference generated by hbm2java
 */
@Entity
@Table(name = "loan_preference", catalog = "mfindb")
public class LoanPreference implements java.io.Serializable {

	private LoanPreferenceId id;
	private Finance finance;
	private LoanMaster loanMaster;
	private Double interestRate;
	private Integer duration;
	private Set<DocCharge> docCharges = new HashSet<DocCharge>(0);

	public LoanPreference() {
	}

	public LoanPreference(LoanPreferenceId id, Finance finance,
			LoanMaster loanMaster) {
		this.id = id;
		this.finance = finance;
		this.loanMaster = loanMaster;
	}

	public LoanPreference(LoanPreferenceId id, Finance finance,
			LoanMaster loanMaster, Double interestRate, Integer duration,
			Set<DocCharge> docCharges) {
		this.id = id;
		this.finance = finance;
		this.loanMaster = loanMaster;
		this.interestRate = interestRate;
		this.duration = duration;
		this.docCharges = docCharges;
	}

	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "loanType", column = @Column(name = "LOAN_TYPE", nullable = false, length = 7)),
			@AttributeOverride(name = "financeId", column = @Column(name = "FINANCE_ID", nullable = false)) })
	public LoanPreferenceId getId() {
		return this.id;
	}

	public void setId(LoanPreferenceId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "FINANCE_ID", nullable = false, insertable = false, updatable = false)
	public Finance getFinance() {
		return this.finance;
	}

	public void setFinance(Finance finance) {
		this.finance = finance;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "LOAN_TYPE", nullable = false, insertable = false, updatable = false)
	public LoanMaster getLoanMaster() {
		return this.loanMaster;
	}

	public void setLoanMaster(LoanMaster loanMaster) {
		this.loanMaster = loanMaster;
	}

	@Column(name = "INTEREST_RATE", precision = 22, scale = 0)
	public Double getInterestRate() {
		return this.interestRate;
	}

	public void setInterestRate(Double interestRate) {
		this.interestRate = interestRate;
	}

	@Column(name = "DURATION")
	public Integer getDuration() {
		return this.duration;
	}

	public void setDuration(Integer duration) {
		this.duration = duration;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "loanPreference")
	public Set<DocCharge> getDocCharges() {
		return this.docCharges;
	}

	public void setDocCharges(Set<DocCharge> docCharges) {
		this.docCharges = docCharges;
	}

}
